/**********************************************************************/
/*  SECTION 3: Analysis using imputed data	
    Notes: 
	Author: Fumiya Uchikoshi

		*/
/**********************************************************************/

********************************************
* Table 1
********************************************
use "Data/imp.dta",replace

mi xtset after yearx

local econ1 "onsenchi_w onsenchi_b farming_w farming_b logpop_w logpop_b income_w income_b unemployment_w unemployment_b health_w health_b"
local econ2 "onsenchi_w onsenchi_b farming_w farming_b logpop_w logpop_b income_w income_b health_w health_b"
local soci1 "turnout_w turnout_b crime_w crime_b ldpvote_w ldpvote_b"
local soci2 "turnout_w turnout_b"
local control "logpot sumexlagdm_b sumexlagdm_w fourdiv3 fourdiv4 nptypex3_w nptypex3_b changebde_w changebde_b yearx1 yearx2 yearx3 yearx4 yearx6 yearx7 yearx8" 

eststo: mi estimate, post: qui xtlogit exdm_m `econ1' `soci1' `control', re nolog
est sto model1
eststo: mi estimate, post: qui xtlogit exdm_m `econ2' `soci2' `control', re nolog
est sto model2
eststo: mi estimate, post: qui xtlogit exdm_m `econ1' `soci1' `control' if yearx8 == 0, re nolog
est sto model3
eststo: mi estimate, post: qui xtlogit exdm_m `econ2' `soci2' `control' if yearx8 == 0, re nolog
est sto model4

esttab model1 model2 model3 model4 using Results/Table1.csv, wide scalar(N) se star(* 0.10 ** 0.05 *** 0.01) b(3) label  replace  title(Exploration)

********************************************
* Table A4
********************************************
local econ3 "onsenchi_w onsenchi_b farming_w farming_b logpop_w logpop_b income_w income_b"
local soci2 "turnout_w turnout_b"
local control "logpot sumexlagdm_b sumexlagdm_w fourdiv3 fourdiv4 nptypex3_w nptypex3_b changebde_w changebde_b yearx1 yearx2 yearx3 yearx4 yearx6 yearx7 yearx8" 

eststo: mi estimate, post: qui xtlogit exdm_m `econ3' `soci2' `control', re nolog
est sto model1
eststo: mi estimate, post: qui xtlogit exdm_m `econ3' `control' , re nolog
est sto model2
eststo: mi estimate, post: qui xtlogit exdm_m `econ3' `soci2' `control' if yearx8 == 0, re nolog
est sto model3
eststo: mi estimate, post: qui xtlogit exdm_m `econ3' `control' if yearx8 == 0, re nolog
est sto model4
esttab model1 model2 model3 model4 using "Results/A4[parsimonious].csv", wide scalar(N) se star(* 0.10 ** 0.05 *** 0.01) b(3) label  replace  title(Exploration)

********************************************
* Table A5
********************************************
local econ4 "onsenchi_w onsenchi_b farming_w farming_b logpop_w logpop_b income_w income_b health_w health_b"
local soci2 "turnout_w turnout_b"
local control "logpot sumexlagdm_b sumexlagdm_w fourdiv3 fourdiv4 nptypex3_w nptypex3_b changebde_w changebde_b yearx1 yearx2 yearx3 yearx4 yearx6 yearx7 yearx8" 

eststo: mi estimate, post: qui xtlogit exdm_m `econ4' `soci2' `control' lfp_w lfp_b, re nolog
est sto model1
eststo: mi estimate, post: qui xtlogit exdm_m `econ4' `control' homerate_w homerate_b, re nolog
est sto model2
eststo: mi estimate, post: qui xtlogit exdm_m `econ4' `control' under15_w under15_b marmale_w marmale_b, re nolog
est sto model3
eststo: mi estimate, post: qui xtlogit exdm_m `econ4' `soci2' `control' totcwins_w totcwins_b, re nolog
est sto model4
esttab model1 model2 model3 model4 using "Results/A5[alternative].csv", wide scalar(N) se star(* 0.10 ** 0.05 *** 0.01) b(3) label  replace  title(Exploration)
